<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib uri="/WEB-INF/tlds/att.tld" prefix="att"%>
<html>
<head>
	<meta name="decorator" content="moduleView" />
	
<script type="text/javascript" language="javascrīpt">
	$(document).ready(function(){
	  // 在这里写你的代码...
	  	
	});
	function printme(){
		document.body.innerHTML=document.getElementById('span').innerHTML+'<br/>'+document.getElementById('home').innerHTML;
		window.print();
	}
	function getUrl(url){ 
	  $("#versionFrame").attr("src",url);
	}
	//确认账单
	function _confirm(){
		var item = confirm("是否已经核对完对账单!");
		if(item){
			$.ajax({
				type: "POST",
				url: "${contextPath}/biz/statement/statementSelfrun/reconciliation",
				data:{ "id":$("#statementSelfrunId").val()},
				success: function(json) {
					var jsonObj =eval('(' + json + ')');
					if(jsonObj.success){
						alert("对账单确认成功!");
						$("#addException").hide();
						$("#reconciliation").hide();
						$("#unReconciliation").text("已对账");
						
					}else{
						alert("对账单确认失败!");
					}
				}
			});
	//		$("#reconciliation").attr("href","${contextPath}/biz/statement/statementSelfrun/reconciliation?id=${statementSelfrun.id}");
	//		alert("对账单确认成功!");
		}
	}
</script>
</head>
<body>
	<input type="hidden" id="statementSelfrunId" value="${statementSelfrun.id}">
	<div class="panel panel-default"> 
		  <div class="col-xs-12 panel-heading">
			  <span class="panel-title o-v-action pull-left" id="span">
			    	自营对账单详细信息  
		    </span>
			    <h3 class="panel-title o-v-action">
			    <a class="btn btn-default btn-sm pull-right" href="${contextPath}/biz/statement/statementSelfrun/list">返回</a>
			    <c:if test="${statementSelfrun.isReconciliation==0}">
			    <a class="btn btn-danger btn-sm pull-right"  role="button" id="addException" href="${contextPath}/biz/statement/statementSelfrunError/add?id=${statementSelfrun.id}">异常</a>
			    <a class="btn btn-success btn-sm pull-right" role="button"  onclick="_confirm()" id="reconciliation">确认</a></c:if>
			    <a class="btn btn-primary btn-sm pull-right" role="button" onclick="printme()"target="_self">打印</a>
			    
			    </h3>
		  </div>
	  <div>
		   <ul class="nav nav-tabs" id="myTab">
		
			</ul> 
			<div class="tab-content">
			  <div class="tab-pane active" id="home">
			  <tags:message content="${message}"/>
				  	<table class="table table-bordered">
					  <tbody>
					  	<tr>
					  		<td class="text-right" style="width: 20%"><strong>是否对账:</strong></td>
					  	<td id="unReconciliation"><ossp:value dictType="RECONCILIATION_TYPE" key="${statementSelfrun.isReconciliation}"></ossp:value></td>
					  	<td class="text-right" style="width: 20%"><strong>是否已勾单:</strong></td>
					  		<td>
									<c:if test="${statementSelfrun.isConfirmed==0}">未勾单 &nbsp&nbsp&nbsp&nbsp
									</c:if>
									<c:if test="${statementSelfrun.isConfirmed==1}">已勾单</c:if>
							</td>
					  	</tr>
					  	<tr>
					  		<td class="text-right"><strong>日期:</strong></td>
					  		<td><fmt:formatDate value="${statementSelfrun.date}" pattern="yyyy-MM-dd"/></td>
					  		<td class="text-right"><strong>供应商编号:</strong></td>
					  		<td>${statementSelfrun.supplierNo}</td>
					  	</tr>
					  	<tr>
					  		<td class="text-right"><strong>供应商名称:</strong></td>
					  		<td>${statementSelfrun.supplierName}</td>
					  		<td class="text-right"><strong>单据类型:</strong></td>
					  		<c:if test="${statementSelfrun.billType eq 'ys'}">
					  		<td>验收单</td>
					  		</c:if>
					  		<c:if test="${statementSelfrun.billType eq 'tj'}">
					  		<td>调价单</td>
					  		</c:if>
					  		<c:if test="${statementSelfrun.billType eq 'th'}">
					  		<td>退货单</td>
					  		</c:if>
					  	</tr>
					  	<c:if test="${statementSelfrun.billType eq 'ys'}">
					  		<tr>
						  		<td class="text-right"><strong>验收单号:</strong></td>
						  		<td><a href="${contextPath}/biz/statement/statementReceiveDetail/list?billNo=${statementReceiveNote.billNo}">${statementReceiveNote.billNo}</a></td>
						  		<td class="text-right"><strong>订单入库:</strong></td>
						  		<td>${statementReceiveNote.receiptType}</td>						  		
					  		</tr>
					  		<tr>
						  		<td class="text-right"><strong>收货门店:</strong></td>
						  		<td>${statementReceiveNote.receiptId}</td>	
						  		<td class="text-right"><strong>收货地点:</strong></td>
						  		<td>${statementReceiveNote.sotreId}</td>				  		
					  		</tr>
					  		<tr>
						  		<td class="text-right"><strong>收货人:</strong></td>
						  		<td>${statementReceiveNote.receiptId}</td>	
						  		<td class="text-right"><strong>收货日期:</strong></td>
						  		<td><fmt:formatDate value="${statementReceiveNote.receiptDate}" pattern="yyyy-MM-dd"/></td>					  		
					  		</tr>
					  	</c:if>
					  	
					  	<c:if test="${statementSelfrun.billType eq 'tj'}">
					  		<tr>
						  		<td class="text-right"><strong>调价单号:</strong></td>
						  		<td><a href="${contextPath}/biz/statement/statementReadJustDetail/list?billNo=${statementSelfrun.billNo}">${statementSelfrun.billNo}</a></td>
						  		<td class="text-right"><strong>补差方式:</strong></td>
						  		<td>${statementReadJustNote.makeupType}</td>					  		
					  		</tr>
					  		<tr>
						  		<td class="text-right"><strong>账扣:</strong></td>
						  		<td>${statementReadJustNote.accDeducution}</td>	
						  		<td class="text-right"><strong>门店号:</strong></td>
						  		<td>${statementReadJustNote.siteId}</td>				  		
					  		</tr>
					  		<tr>
						  		<td class="text-right"><strong>备注:</strong></td>
						  		<td>${statementReadJustNote.remark}</td>
						  		<td class="text-right"><strong>调整日期:</strong></td>
						  		<td><fmt:formatDate value="${statementReadJustNote.date}" pattern="yyyy-MM-dd"/></td>						  		
					  		</tr>
					  	</c:if>
					  	<c:if test="${statementSelfrun.billType eq 'th'}">
					  		<tr>
						  		<td class="text-right"><strong>调价单号:</strong></td>
						  		<td><a href="${contextPath}/biz/statement/statementReadJust/list?billNo=${statementSelfrun.id}"">${statementSelfrun.billNo}</a></td>
						  		<td class="text-right"><strong>补差方式:</strong></td>
						  		<td>${statementReadJustNote.makeupType}</td>						  		
					  		</tr>
					  		<tr>
						  		<td class="text-right"><strong>账扣:</strong></td>
						  		<td>${statementReadJustNote.accDeducution}</td>
						  		<td class="text-right"><strong>门店号:</strong></td>
						  		<td>${statementReadJustNote.siteId}</td>					  		
					  		</tr>
					  		<tr>
						  		<td class="text-right"><strong>备注:</strong></td>
						  		<td>${statementReadJustNote.remark}</td>
						  		<td class="text-right"><strong>调整日期:</strong></td>						  		
						  		<td><fmt:formatDate value="${statementReadJustNote.date}" pattern="yyyy-MM-dd"/></td>						  		
					  		</tr>
					  	</c:if>
					  </tbody>
					  	
					</table>
					
				 </div>
				
				 <div class="tab-pane" id="history">
					<iframe id="versionFrame"   name="versionFrame"  
									scrolling="no" frameborder="no" width="100%"></iframe>
				 </div>
			</div> 
		</div> 
	</div>
	<script type="text/javascript" src="${staticPath}/js/list.js"></script>	
</body>
</html>